﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SysSurv.bll;

namespace SysSurv
{
    public partial class frmNewUser : Form
    {
        public frmNewUser()
        {
            InitializeComponent();
        }

        private void btnCreateUser_Click(object sender, EventArgs e)
        {
            if (txtNick.Text == "") {
                MessageBox.Show("Debe ingresar un nick");
            }
            else if (txtPass.Text == "")
            {
                MessageBox.Show("Debe ingresar su contraseña");
            }
            else
            {
                try
                {
                    if (txtPass.Text == txtPassConfirm.Text)
                    {
                        Wiii.getInstance().createUser(txtNick.Text, txtPass.Text);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Las contraseñas ingresadas no coinciden");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
    }
}
